function [alpha fval] = mySVMquadprocOpt(pshi,lossvec,C,A,no_constraints,m)
% pshi is a feature matrix size mxn  pshi(x,y) = phi(xi,yi)-phi(xi,y)
% C is the SVM C constant that multiply Sum of Sai(s)
% m is number of training samples, which will become the size of alpha
% n is the dimension of the weights, which is equals to dimension of X



%Type 1

P = pshi*pshi';
lb = zeros(no_constraints,1); 
ub=[];%C/m*ones(no_constraints,1);
Aeq=[];
beq=[];
c = -lossvec;
no_alpha_i = size(A,1);
b=C/m*ones(no_alpha_i,1);%C/m;%0; 

if no_constraints ~= size(A,2)
    fprintf('some error calculating G, check calConstraints.m\n');
    adf
end

%G=-eye(m);h=zeros(m,1) ; lb=[];ub=[];
% 
% c = -ones(m,1)
% Aeq = ones(1,m);
% beq=0;



opts= optimset ( 'Algorithm','interior-point-convex') ;
 [alpha fval]= quadprog(P,c,A,b,Aeq,beq,lb,ub,[],opts);
  fval = -fval;%because we min the negative objective fn. The true dual obj value is therefore -fval
